<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
   /*public function index(){
        $Data     = M('Data');// 实例化Data数据模型
        $result     = $Data->select();
        $this->assign('result',$result);
        $this->display();
    }*/
     public function index(){
        $Data     = M('message');// 实例化Data数据模型
        $result     = $Data->select();
        $this->assign('result',$result);
        $this->display();
    }
     public function add(){
        $name = "李四";
        $create_time = time();
        //{$create_time|date="y-m-d",###}
        $data['username'] = $name;
        $data['time'] = $create_time; 
        $this->assign('username',$name);
        $this->assign('time',$create_time);
        $this->assign('data',$data);
        $this->display();
    }
  /* public function insert(){
      $Data   =   M('Data');
      //$data['username']  = I('post.username');
      $data['data']    = I('post.message');
      //$data['sex']    = I('post.sex');
      //$data['content']    = I('post.message');
      //$data['avater']    = I('post.imgurl');
      //$data['time_at']  = time();
      $Data->add($data);

    } */
    public function insert(){
      $Data   =   M('message');
      $data['username']  = I('post.username');
      //$data['data']    = I('post.message');
      $data['sex']    = I('post.sex');
      $data['content']    = I('post.message');
      $data['avater']    = I('post.imgurl');
      $data['time_at']  = time();
      $Data->add($data);

    }





}





